import {PLUS, SUB} from '../type'

// 初始化
const initState = 0

export default function countReducer(preState = initState, action) {
    if (action.type === PLUS) {
        return preState + action.data
    } else if (action.type === SUB) {
        return preState - action.data
    } else {
        return preState
    }
}
